﻿#ifndef SQLTHREAD_H
#define SQLTHREAD_H

#include <QThread>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDateTime>
#include "setting.h"
#include "chart.h"

class SqlThread : public QThread
{
    Q_OBJECT
public:
    SqlThread();
    ~SqlThread();
    QSplineSeries* series;

protected:
    virtual void run() override;

public slots:
    void uploadDataInj(const int i, const Injector&);
    void searchDataInj(const QDate& time);
    void uploadDataDTU(const int i, const int current);
    void searchDataDTU(const QDateTime& time, const int id);

signals:
    void sigSearchDataInj(const QString& context, const QDate& time);
    void sigSearchDataDTU(QSplineSeries*);

private:
    QSqlDatabase db;

};

#endif // SQLTHREAD_H
